﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace Teris
{
    internal abstract class BOEScene : ISceneUpdate
    {
        protected  string title;
        protected  string strOne;

        protected int option = 0;

        public void Update()
        {
            Console.SetCursorPosition(Game.w/2- title.Length, 5);
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(title);

            Console.SetCursorPosition(Game.w / 2 - strOne.Length, 10);
            Console.ForegroundColor = option==0?ConsoleColor.Red:ConsoleColor.White;
            Console.WriteLine(strOne);

            Console.SetCursorPosition(Game.w / 2 - 4, 15);
            Console.ForegroundColor = option == 1 ? ConsoleColor.Red : ConsoleColor.White; ;
            Console.WriteLine("结束游戏");

            switch (Console.ReadKey(true).Key)
            {
                case ConsoleKey.W:
                    option = Math.Max(option - 1, 0);
                    break;
                case ConsoleKey.S:
                    option = Math.Min(option + 1, 1);
                    break;
                case ConsoleKey.J:
                    EnterJDoSomething();
                    break;
            }
        }

        protected abstract void EnterJDoSomething();
    }
}
